<template>
  <el-row>
    <el-col :span="10">
      <div class="app-container">
        <el-form
          :model="queryParams"
          ref="queryForm"
          :inline="true"
          v-show="showSearch"
          label-width="68px"
        >
          <!--          <el-form-item label="盘点编号" prop="code">-->
          <!--            <el-input-->
          <!--              v-model="queryParams.code"-->
          <!--              placeholder="请输入盘点编号"-->
          <!--              clearable-->
          <!--              size="small"-->
          <!--              @keyup.enter.native="handleQuery"-->
          <!--            />-->
          <!--          </el-form-item>-->
          <el-form-item label="盘点仓库" prop="depotId">
            <el-select
              v-model="queryParams.depotId"
              placeholder="请选择仓库"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            >
              <el-option
                v-for="depot in depotOptions"
                :key="depot.id"
                :label="depot.name"
                :value="depot.id"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="记录名称" prop="name">
            <el-input
              v-model="queryParams.name"
              placeholder="请输入记录名称"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <!--          <el-form-item label="开始时间">-->
          <!--            <el-date-picker-->
          <!--              v-model="daterangeStartTime"-->
          <!--              size="small"-->
          <!--              style="width: 240px"-->
          <!--              value-format="yyyy-MM-dd"-->
          <!--              type="daterange"-->
          <!--              range-separator="-"-->
          <!--              start-placeholder="开始日期"-->
          <!--              end-placeholder="结束日期"-->
          <!--            ></el-date-picker>-->
          <!--          </el-form-item>-->
          <el-form-item label="盘点状态" prop="status">
            <el-select
              v-model="queryParams.status"
              placeholder="请选择盘点状态"
              clearable
              size="small"
            >
              <el-option
                v-for="dict in statusOptions"
                :key="dict.dictValue"
                :label="dict.dictLabel"
                :value="dict.dictValue"
              />
            </el-select>
          </el-form-item>

          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleQuery"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
              >重置</el-button
            >
          </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
              v-hasPermi="['equipment:inventory:add']"
              >新增</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleUpdate"
              v-hasPermi="['equipment:inventory:edit']"
              >修改</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="single"
              @click="handleDelete"
              v-hasPermi="['equipment:inventory:remove']"
              >删除</el-button
            >
          </el-col>
          <!--          <el-col :span="1.5">-->
          <!--            <el-button-->
          <!--              type="warning"-->
          <!--              plain-->
          <!--              icon="el-icon-download"-->
          <!--              size="mini"-->
          <!--              @click="handleExport"-->
          <!--              v-hasPermi="['equipment:inventory:export']"-->
          <!--              >导出</el-button-->
          <!--            >-->
          <!--          </el-col>-->
          <right-toolbar
            :showSearch.sync="showSearch"
            @queryTable="getList"
          ></right-toolbar>
        </el-row>

        <el-table
          v-loading="loading"
          :data="inventoryList"
          @current-change="handleSelectionChange"
          highlight-current-row
          cell-class-name="li_table"
          max-height="550"
        >
          <!--          <el-table-column type="selection" width="55" align="center" />-->
          <!--          <el-table-column label="盘点编号" align="center" prop="code" />-->
          <el-table-column label="记录名称" align="center" prop="name" />
          <el-table-column label="盘点仓库" align="center" prop="depotName" />
          <!--          <el-table-column label="开始时间" align="center" prop="startTime" width="180">-->
          <!--            <template slot-scope="scope">-->
          <!--              <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <!--          <el-table-column label="结束时间" align="center" prop="endTime" width="180">-->
          <!--            <template slot-scope="scope">-->
          <!--              <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <el-table-column
            label="盘点状态"
            align="center"
            prop="status"
            :formatter="statusFormat"
          />
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-view"
                @click="handleView(scope.row)"
                >查看</el-button
              >
              <!--              <el-button-->
              <!--                size="mini"-->
              <!--                type="text"-->
              <!--                icon="el-icon-edit"-->
              <!--                @click="handleUpdate(scope.row)"-->
              <!--                v-hasPermi="['equipment:inventory:edit']"-->
              <!--              >修改</el-button>-->
              <!--              <el-button-->
              <!--                size="mini"-->
              <!--                type="text"-->
              <!--                icon="el-icon-delete"-->
              <!--                @click="handleDelete(scope.row)"-->
              <!--                v-hasPermi="['equipment:inventory:remove']"-->
              <!--              >删除</el-button>-->
            </template>
          </el-table-column>
        </el-table>

        <pagination
          v-show="total > 0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getList"
        />

        <!-- 添加或修改库存盘点对话框 -->
        <el-dialog
          v-myFullscreen
          :title="title"
          :visible.sync="open"
          width="1100px"
          append-to-body
          v-myDialogDrag
        >
          <el-form ref="form" :model="form" :rules="rules" label-width="120px">
            <el-row>
              <el-col :span="12">
                <el-form-item label="盘点编号" prop="code">
                  <el-input
                    v-model="form.code"
                    placeholder="请输入盘点编号"
                    :disabled="openDisabled"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="记录名称" prop="name">
                  <el-input
                    v-model="form.name"
                    placeholder="请输入记录名称"
                    :disabled="openDisabled"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-col :span="12">
                  <el-form-item label="盘点仓库" prop="depotId">
                    <el-select
                      v-model="form.depotId"
                      placeholder="请选择仓库"
                      :disabled="openDisabled"
                    >
                      <el-option
                        v-for="depot in depotOptions"
                        :key="depot.id"
                        :label="depot.name"
                        :value="depot.id"
                      ></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12" v-if="openDisabled">
                  <el-form-item label="盘点人员名称" prop="userNames">
                    <el-input
                      v-model="form.userNames"
                      placeholder="请输入盘点人员名称"
                      :disabled="openDisabled"
                    />
                  </el-form-item>
                </el-col>
              </el-col>
              <el-col :span="12">
                <el-form-item label="开始时间" prop="startTime">
                  <el-date-picker
                    :editable="false"
                    clearable
                    size="small"
                    v-model="form.startTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择开始时间"
                    :disabled="openDisabled"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="结束时间" prop="endTime">
                  <el-date-picker
                    :editable="false"
                    clearable
                    size="small"
                    v-model="form.endTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择结束时间"
                    :disabled="openDisabled"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="盘点状态" prop="status">
                  <el-radio-group
                    v-model="form.status"
                    :disabled="openDisabled"
                  >
                    <el-radio
                      v-for="dict in statusOptions"
                      :key="dict.dictValue"
                      :label="dict.dictValue"
                      >{{ dict.dictLabel }}</el-radio
                    >
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <!--              <el-col :span="12">-->
              <!--                <el-form-item label="盘点人员" prop="userIds">-->
              <!--                  <el-input v-model="form.userIds" placeholder="请输入盘点人员" :disabled="openDisabled" />-->
              <!--                </el-form-item>-->
              <!--              </el-col>-->
              <el-col :span="24">
                <el-form-item label="备注" prop="remark">
                  <el-input
                    v-model="form.remark"
                    type="textarea"
                    placeholder="请输入内容"
                    :disabled="openDisabled"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <div slot="footer" class="dialog-footer" v-if="!openDisabled">
            <el-button type="primary" @click="submitForm">确 定</el-button>
            <el-button @click="cancel">取 消</el-button>
          </div>
        </el-dialog>
      </div>
    </el-col>
    <el-col :span="14">
      <div class="app-container">
        <el-form
          :model="queryParamsGoods"
          ref="queryFormGoods"
          :inline="true"
          v-show="showSearchGoods"
          label-width="68px"
        >
          <!--          <el-form-item label="库位ID" prop="depotId">-->
          <!--            <el-input-->
          <!--              v-model="queryParamsGoods.depotId"-->
          <!--              placeholder="请输入库位ID"-->
          <!--              clearable-->
          <!--              size="small"-->
          <!--              @keyup.enter.native="handleQuery"-->
          <!--            />-->
          <!--          </el-form-item>-->

          <el-form-item label="货位编号" prop="goodsSpaceCode">
            <el-input
              v-model="queryParamsGoods.goodsSpaceCode"
              placeholder="请输入货位编号"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="物资编号" prop="productCode">
            <el-input
              v-model="queryParamsGoods.productCode"
              placeholder="请输入物资编号"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <!--          <el-form-item label="状态" prop="status">-->
          <!--            <el-select v-model="queryParamsGoods.status" placeholder="请选择状态" clearable size="small">-->
          <!--              <el-option label="请选择字典生成" value="" />-->
          <!--            </el-select>-->
          <!--          </el-form-item>-->
          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleQueryGoods"
              >搜索</el-button
            >
            <el-button
              icon="el-icon-refresh"
              size="mini"
              @click="resetQueryGoods"
              >重置</el-button
            >
          </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8" v-if="showButton">
          <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="selectInPro"
              v-hasPermi="['equipment:inventoryGoods:add']"
              >选择盘点货位</el-button
            >
          </el-col>
          <!--          <el-col :span="1.5">-->
          <!--            <el-button-->
          <!--              type="warning"-->
          <!--              plain-->
          <!--              icon="el-icon-download"-->
          <!--              size="mini"-->
          <!--              @click="handleExportGoods"-->
          <!--              v-hasPermi="['equipment:inventoryGoods:export']"-->
          <!--            >导出</el-button>-->
          <!--          </el-col>-->
          <right-toolbar
            :showSearch.sync="showSearchGoods"
            @queryTable="getListGoods"
          ></right-toolbar>
        </el-row>
        <vxe-table
          border
          resizable
          show-overflow
          keep-source
          :row-class-name="tableRowClassName"
          ref="xTable"
          :loading="loadingGoods"
          :data="inventoryGoodsList"
          :edit-config="{ trigger: 'manual', mode: 'row' }"
        >
          <!--          <el-table-column type="selectionGoods" width="55" align="center" />-->
          <vxe-column title="货位编号" align="center" field="goodsSpaceCode" />
          <vxe-column title="物资编号" align="center" field="productCode" />
          <vxe-column title="物资名称" align="center" field="productName" />
          <vxe-column title="物资规格" align="center" field="model" />
          <vxe-column title="库存数量" align="center" field="stockNum" />
          <vxe-column
            title="盘点数量"
            align="center"
            field="inventoryNum"
            :edit-render="{ name: 'input', attrs: { type: 'text' } }"
          />
          <vxe-column title="单位" align="center" field="unit" />
          <vxe-column
            title="状态"
            align="center"
            field="status"
            :formatter="stockInventoryStatusFormat"
          />
          <vxe-column
            title="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template #default="{ row }">
              <template v-if="$refs.xTable.isActiveByRow(row)">
                <vxe-button @click="saveRowEvent(row)">保存</vxe-button>
                <vxe-button @click="cancelRowEvent(row)">取消</vxe-button>
              </template>
              <template v-else>
                <vxe-button v-if="showButton" @click="editRowEvent(row)"
                  >盘点</vxe-button
                >
              </template>
            </template>
          </vxe-column>
        </vxe-table>

        <pagination
          v-show="totalGoods > 0"
          :total="totalGoods"
          :page.sync="queryParamsGoods.pageNum"
          :limit.sync="queryParamsGoods.pageSize"
          @pagination="getListGoods"
        />
      </div>
    </el-col>
    <StockSelect ref="selectStockS" @childFn="parentFn" />
  </el-row>
</template>
<style>
.vxe-table .warning-row {
  background: red !important;
  color: #fff;
}

.vxe-table .success-row {
  background: #187 !important;
  color: #fff;
}
</style>
<script>
import {
  listInventory,
  getInventory,
  delInventory,
  addInventory,
  updateInventory,
} from "@/api/equipment/materials/stockInventory";
import {
  listInventoryGoods,
  getInventoryGoods,
  delInventoryGoods,
  addInventoryGoods,
  updateInventoryGoods,
} from "@/api/equipment/materials/stockInventoryGoods";
import { listDepot, getDepot } from "@/api/equipment/materials/depot";
import StockSelect from "./stockSelects";
export default {
  name: "Inventory",
  components: {
    StockSelect,
  },
  data() {
    return {
      //弹窗是否禁止编辑
      openDisabled: true,
      openDisabledGoods: true,
      showButton: false,
      // 遮罩层
      loading: true,
      loadingGoods: false,
      // 选中数组
      ids: [],
      id: 0,
      idsGoods: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      showSearchGoods: true,
      // 总条数
      total: 0,
      totalGoods: 0,
      // 库存盘点表格数据
      inventoryList: [],
      // 盘点记录-物资列表格数据
      inventoryGoodsList: [],
      // 弹出层标题
      title: "",
      titleGoods: "",
      // 是否显示弹出层
      open: false,
      openGoods: false,
      // 开始时间时间范围
      daterangeStartTime: [],
      // 盘点状态字典
      statusOptions: [],
      stockInventoryStatusOptions: [],
      // 所属仓库
      depotOptions: [],
      //选中数据
      selectRow: null,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 50,
        code: null,
        name: null,
        depotId: null,
        startTime: null,
        endTime: null,
        status: null,
        userIds: null,
        userNames: null,
      },
      // 查询参数
      queryParamsGoods: {
        pageNum: 1,
        pageSize: 10,
        recordId: null,
        depotId: null,
        goodsSpaceId: null,
        goodsSpaceCode: null,
        productId: null,
        productCode: null,
        stockNum: null,
        unit: null,
        inventoryNum: null,
        status: null,
      },
      // 表单参数
      form: {},
      formGoods: {},
      // 表单校验
      rules: {
        code: [{ required: true, message: "不能为空", trigger: "blur" }],
        name: [{ required: true, message: "不能为空", trigger: "blur" }],
        depotId: [{ required: true, message: "不能为空", trigger: "blur" }],
        status: [{ required: true, message: "不能为空", trigger: "blur" }],
        applyTime: [{ required: true, message: "不能为空", trigger: "blur" }],
      },
    };
  },
  created() {
    this.getList();
    this.getDicts("inventory_status").then((response) => {
      this.statusOptions = response.data;
    });
    this.getDicts("stock_inventory_status").then((response) => {
      this.stockInventoryStatusOptions = response.data;
    });
    this.getDepot();
  },
  methods: {
    tableRowClassName({ row, rowIndex }) {
      if (row.status == "02") {
        return "warning-row";
      } else if (row.status == "03") {
        return "success-row";
      }
      return "";
    },
    editRowEvent(row) {
      const $table = this.$refs.xTable;
      $table.setActiveRow(row);
    },
    saveRowEvent(row) {
      const $table = this.$refs.xTable;
      $table.clearActived().then(() => {
        this.loadingGoods = true;
        if (row.inventoryNum != null) {
          if (row.inventoryNum == row.stockNum) {
            row.status = "01";
          } else if (row.inventoryNum > row.stockNum) {
            row.status = "03";
          } else if (row.inventoryNum < row.stockNum) {
            row.status = "02";
          }
        }
        updateInventoryGoods(row).then((response) => {
          this.msgSuccess("修改成功");
          this.loadingGoods = false;
          this.getListGoods();
        });
      });
    },
    cancelRowEvent(row) {
      const $table = this.$refs.xTable;
      $table.clearActived().then(() => {
        // 还原行数据
        $table.revertData(row);
      });
    },
    selectInPro() {
      this.$refs.selectStockS.show(this.selectRow.depotId, this.selectRow.id);
    },
    parentFn(ids) {
      addInventoryGoods(ids, this.selectRow.id).then((response) => {
        this.getListGoods();
      });
    },
    getDepot() {
      this.loading = true;
      let depotParams = {
        type: "01",
        parentId: null,
        ancestors: null,
      };
      listDepot(depotParams).then((response) => {
        this.depotOptions = response.data;
        this.loading = false;
      });
    },
    /** 查询库存盘点列表 */
    getList() {
      this.loading = true;
      this.queryParams.params = {};
      if (null != this.daterangeStartTime && "" != this.daterangeStartTime) {
        this.queryParams.params["beginStartTime"] = this.daterangeStartTime[0];
        this.queryParams.params["endStartTime"] = this.daterangeStartTime[1];
      }
      listInventory(this.queryParams).then((response) => {
        this.inventoryList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
      this.buttonStatus();
    },
    /** 查询盘点记录-物资列列表 */
    getListGoods() {
      this.loadingGoods = true;
      this.queryParamsGoods.depotId = this.selectRow.depotId;
      this.queryParamsGoods.recordId = this.selectRow.id;
      listInventoryGoods(this.queryParamsGoods).then((response) => {
        this.inventoryGoodsList = response.rows;
        this.totalGoods = response.total;
        this.loadingGoods = false;
      });
    },
    // 盘点状态字典翻译
    statusFormat(row, column) {
      return this.selectDictLabel(this.statusOptions, row.status);
    },
    stockInventoryStatusFormat({ cellValue }) {
      return this.selectDictLabel(this.stockInventoryStatusOptions, cellValue);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 取消按钮
    cancelGoods() {
      this.openGoods = false;
      this.resetGoods();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        code: null,
        name: null,
        depotId: null,
        startTime: null,
        endTime: null,
        status: null,
        userIds: null,
        userNames: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        delFlag: null,
        remark: null,
      };
      this.resetForm("form");
    },
    resetGoods() {
      this.formGoods = {
        id: null,
        recordId: null,
        depotId: null,
        goodsSpaceId: null,
        goodsSpaceCode: null,
        productId: null,
        productCode: null,
        stockNum: null,
        unit: null,
        inventoryNum: null,
        status: "0",
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        delFlag: null,
        remark: null,
      };
      this.resetForm("formGoods");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    handleQueryGoods() {
      this.queryParamsGoods.pageNum = 1;
      if (this.selectRow != null) {
        this.getListGoods();
      } else {
        this.$message.error("请先点击左侧列表选择一条盘点记录");
      }
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeStartTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    resetQueryGoods() {
      this.resetForm("queryFormGoods");
      this.handleQueryGoods();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.selectRow = selection;
      this.buttonStatus();
      if (this.selectRow != null) {
        this.getListGoods();
      } else {
        this.inventoryGoodsList = null;
      }
    },
    buttonStatus() {
      if (this.selectRow != null) {
        this.id = this.selectRow.id;
        this.single = this.id == 0;
        this.multiple = this.id == 0;
        if (this.selectRow.status == "01") {
          this.single = false;
          this.multiple = false;
          this.showButton = true;
        } else {
          this.single = true;
          this.multiple = true;
          this.showButton = false;
        }
      } else {
        this.single = true;
        this.multiple = true;
        this.showButton = false;
      }
    },
    handleSelectionChangeGoods(selection) {
      this.idsGoods = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.openDisabled = false;
      this.open = true;
      this.title = "添加库存盘点";
    },
    handleAddGoods() {
      this.resetGoods();
      this.openDisabledGoods = false;
      this.openGoods = true;
      this.titleGoods = "添加盘点记录-物资列";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      this.openDisabled = false;
      const id = row.id || this.id;
      getInventory(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改库存盘点";
      });
    },
    handleUpdateGoods(row) {
      this.resetGoods();
      this.openDisabledGoods = false;
      const id = row.id || this.idsGoods;
      getInventoryGoods(id).then((response) => {
        this.formGoods = response.data;
        this.openGoods = true;
        this.titleGoods = "修改盘点记录-物资列";
      });
    },
    /** 查看按钮 */
    handleView(row) {
      this.reset();
      this.openDisabled = true;
      const id = row.id || this.ids;
      getInventory(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "查看库存盘点";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateInventory(this.form).then((response) => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            const rLoading = this.openLoading();
            addInventory(this.form)
              .then((response) => {
                this.msgSuccess("新增成功");
                this.open = false;
                rLoading.close();
                this.getList();
              })
              .catch((error) => {
                rLoading.close();
              });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.id;
      this.$confirm(
        '是否确认删除库存盘点编号为"' + ids + '"的数据项?',
        "警告",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then(function () {
          return delInventory(ids);
        })
        .then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    handleDeleteGoods(row) {
      const ids = row.id || this.idsGoods;
      this.$confirm(
        '是否确认删除盘点记录-物资列编号为"' + ids + '"的数据项?',
        "警告",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then(function () {
          return delInventoryGoods(ids);
        })
        .then(() => {
          this.getListGoods();
          this.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "equipment/inventory/export",
        {
          ...this.queryParams,
        },
        "库存盘点" + this.parseTime(new Date()) + ".xlsx"
      );
    },
    handleExportGoods() {
      this.download(
        "equipment/inventoryGoods/export",
        {
          ...this.queryParams,
        },
        "盘点记录-物资列表" + this.parseTime(new Date()) + ".xlsx"
      );
    },
  },
};
</script>
